<template>
  <div class="card">
    <h3>大文件上传</h3>
    <section class="upload_box" id="upload7">
      <input
        ref="inputRef"
        type="file"
        class="upload_inp"
        @change="changeFile"
      />
      <div class="upload_button_box">
        <button
          class="upload_button select"
          :class="[loading ? 'loading' : '']"
          @click="selectFile"
        >
          上传图片
        </button>
      </div>
      <div class="upload_progress" v-if="loading">
        <div class="value" :style="{ width: progress }"></div>
      </div>
    </section>
  </div>
</template>

<script setup>
import { useUploadLargeFile } from "@/hook";
// 封装上传钩子
let { inputRef, loading, progress, selectFile, changeFile } =
  useUploadLargeFile({
    immediate: true,
  });
console.log(progress);
</script>
